import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ExportBillVO, ExportBillForm, ExportBillQuery } from '@/api/warehouse/exportBill/types';

/**
 * 查询出库单列表
 * @param query
 * @returns {*}
 */

export const listExportBill = (query?: ExportBillQuery): AxiosPromise<ExportBillVO[]> => {
  return request({
    url: '/warehouse/exportBill/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询出库单详细
 * @param id
 */
export const getExportBill = (id: string | number): AxiosPromise<ExportBillVO> => {
  return request({
    url: '/warehouse/exportBill/' + id,
    method: 'get'
  });
};

/**
 * 新增出库单
 * @param data
 */
export const addExportBill = (data: ExportBillForm) => {
  return request({
    url: '/warehouse/exportBill',
    method: 'post',
    data: data
  });
};

/**
 * 修改出库单
 * @param data
 */
export const updateExportBill = (data: ExportBillForm) => {
  return request({
    url: '/warehouse/exportBill',
    method: 'put',
    data: data
  });
};

/**
 * 删除出库单
 * @param id
 */
export const delExportBill = (id: string | number | Array<string | number>) => {
  return request({
    url: '/warehouse/exportBill/' + id,
    method: 'delete'
  });
};
